Hi Sam,
Thanks for reaching out to us about this.
You can take a look here at the POST integration call that you can make that will create a CET:
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/vnd.pagerduty+json;version=2' --header 'Authorization: Token token=REDACTED' -d '{
"integration": {
"type": "event_transformer_api_inbound_integration",
"summary": "Creating CET in API",
"name": "Creating CET in API",
"service": {
"id": "REDACTED",
"type": "service_reference",
},
"vendor": {
"id": "REDACTED",
"type": "vendor"
},
"config": {
"fields": {
"code": {
"type": "code",
"required": false,
"label": "The code you want to execute.",
"value": "var normalized_event = {\n event_type: PD.Trigger,\n description: \"Custom Event Transform\",\n details: PD.inputRequest\n};\n\nPD.emitGenericEvents([normalized_event]);",
"ui_order": 0
},
"debug": {
"type": "select",
"required": false,
"label": "Debug mode (send an event to your service if code produces errors)",
"valid_values": {
"debug_on": {
"label": "Enabled",
"ui_order": 1
},
"debug_off": {
"label": "Disabled",
"ui_order": 2
}
},
"value": "debug_on",
"ui_order": 1
}
}
}
}
}' 'https://api.pagerduty.com/services/REDACTED/integrations'
However, the value that the CET has when it is Posted, where that custom code is kept, gets wiped in the Response Body and resulting CET.
There is a potential workaround that our team had mentioned after looking internally about this that might be of use to you. You can try creating (POST) the CET, then edit (PUT) it to give it the custom code you want it to have.
This should work for you in the meantime to create the CET.
Hope this helps and let me know if you have any other questions!